

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
		<resource:dateChooser/>
        <title>Create System</title>         
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">System List</g:link></span>
        </div>
        <div class="body">
            <h1>Create System</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${reportSystem}">
            <div class="errors">
                <g:renderErrors bean="${reportSystem}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="codeSystem">Code System:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'codeSystem','errors')}">
                                    <input type="text" id="codeSystem" name="codeSystem" value="${fieldValue(bean:reportSystem,field:'codeSystem')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="descrSystem">Descr System:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'descrSystem','errors')}">
                                    <input type="text" id="descrSystem" name="descrSystem" value="${fieldValue(bean:reportSystem,field:'descrSystem')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="reportDirectory">Report Directory:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'reportDirectory','errors')}">
                                    <input class="orderByText" type="text" id="reportDirectory" name="reportDirectory" value="${fieldValue(bean:reportSystem,field:'reportDirectory')}"/>
                                </td>
                            </tr> 
							
							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="databaseType">Database Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'databaseType','errors')}">
                                    <g:select id="databaseType" name="databaseType" from="${reportSystem.constraints.databaseType.inList.collect{it.encodeAsHTML()}}" value="${fieldValue(bean:reportSystem,field:'databaseType')}" ></g:select>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="systemEnded">System Ended:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'systemEnded','errors')}">
                                    <g:select id="systemEnded" name="systemEnded" from="${reportSystem.constraints.systemEnded.inList.collect{it.encodeAsHTML()}}" value="${fieldValue(bean:reportSystem,field:'systemEnded')}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="reports">Reports:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'reports','errors')}">
                                    
<ul>
<g:each var="r" in="${reportSystem?.reports?}">
    <li><g:link controller="report" action="show" id="${r.id}">${r}</g:link></li>
</g:each>
</ul>
<g:link controller="report" params="["reportSystem.id":reportSystem?.id]" action="create"><p class="childLink">Add Report</p></g:link>

                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Create" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
